package com.zqk.pattern.creational.singleton.fanshe;

import java.io.Serializable;

/**
 * @Package com.zqk.pattern.creational.singleton.hungrysingleton
 * @Description:TODO
 * @Author 张乾坤
 * @Create: 2018/10/26
 * @Version 1.0
 * @Update: message
 */
public class HungrySingleton implements Serializable {
    private final  static HungrySingleton hungrySingleton=new HungrySingleton();
    private HungrySingleton(){
        if(hungrySingleton!=null){
            throw new RuntimeException("不能在生成了");
        }
    }

   public static HungrySingleton getInstance(){
        return hungrySingleton;
    }
    private Object readResolve(){
        return hungrySingleton;
    }
}
